﻿namespace Web.Control.WWW.Session
{
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Model.WWW_User.Teach;
    using BLF.WWW_User.Teach;
    using Lx.Web.Common.ControlsUI;
    using System.Collections.Generic;
    using System.Collections;
    using Model.WWW_User.User;
    public class addasession : BaseControl
    {
        protected string Memberno = "";
        protected string TMemberno = "";
        protected int pay=4;
        protected string PayCreate = System.Configuration.ConfigurationManager.AppSettings["PayCreate"];
        protected string PayAddfund = System.Configuration.ConfigurationManager.AppSettings["PayAddfund"];
        protected override void OnLoad(EventArgs e)
        {
            string qurl = "";
            Memberno = HttpContext.Current.User.Identity.Name;
            if (Memberno == "")
            {
                Page.Response.Redirect("/user/login.htm?ReturnUrl=" + Page.Request.Url.AbsoluteUri);
                return;
            }
            if (Page.Request.Url.AbsoluteUri.Split('?').Length == 2)
            {
                 qurl = Page.Request.Url.AbsoluteUri.Split('?')[1];
            }
            else {
                Response.End();
            }
            if (!string.IsNullOrEmpty(Request["tid"]))
            {
                TMemberno = Request["tid"].ToString();
            }
            if (TMemberno.Trim().Length != 10||TMemberno==Memberno)
            {
                Response.End();
            }
            pay = Teach.GetPayment(TMemberno,Memberno);
            if (pay == 1) { Response.Redirect("/session/addsession.htm?"+qurl); }
            base.OnLoad(e);
        }
    }
}